<template>
  <div>
    <el-card :body-style="{ padding: '0px' }">
      <img class="image" />
      <el-image
        style="width: 100px; height: 100px"
        :src="userInfo.img"
        :preview-src-list="[userInfo.img]"
      >
      </el-image>
      <div style="padding: 14px">
        <span>{{ userInfo.name }}</span>
        <div class="bottom clearfix">
          <time class="time"></time>
          <el-upload
            class="upload-demo"
            action="/api/upload"
            multiple
            :on-success="onSuccess"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
import { mapState } from "vuex";
import { getUserInfo } from '@/utils'
export default {
  computed: {
    ...mapState(["userInfo"]),
  },
  methods: {
      // 文件上传成功时的回调函数
      onSuccess() {
          getUserInfo()
      }
  },
};
</script>

